﻿using System.Configuration;
using System.Web.Mvc;
using ControleRepresentante.Logic.Models;
using ControleRepresentante.Logic.Repositories;
using WebSite.Controllers.ControllerExtensions;
using WebSite.ViewModels;

namespace WebSite.Controllers
{
    public class SyncController : ControllerBase<IUserRepository>
    {
        public SyncController(IRepositoryProvider repositoryProvider, IControllerExtensionProvider controllerExtensionProvider)
            : base(repositoryProvider, controllerExtensionProvider)
        {
        }

        protected override Area? Area { get { return ControleRepresentante.Logic.Models.Area.Sync; } }

        public ActionResult Index()
        {
            EnsureHasPermission(Operacao.Synchronize);
            string syncAppClickOnceUrl = ConfigurationManager.AppSettings["SyncAppClickOnceUrl"];
            return View(new SyncViewModel(syncAppClickOnceUrl));
        }
    }
}